package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.Myself;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface MyselfMapper {

    /**
     * 根据用户名查询用户
     */
    @Select("select * from admin where username = #{username}")
    Myself getByUsername(String username);


    /**
     * 插入用户数据
     */

    @AutoFill(value = OperationType.INSERT)
    @Select("insert into admin (name, username, phone, qq, wechat, sex, avatar, create_time, update_time,password,root) " +
            "values (#{name}, #{username},  #{phone}, #{qq}, #{wechat}, #{sex}, #{avatar}, #{createTime}, #{updateTime},#{password}, #{root})")
    void insertUser(Myself myself);

    @Select("select * from admin")
    Myself findMyselfInfo();
}